//类中属性的封装,get,set
class XiaoJieJie12 {
  constructor(private _age: number) {}
  get age() {
    return this._age - 10;
  }
  set age(age: number) {
    this._age = age;
  }
}

const dajiao = new XiaoJieJie12(18);
console.log(dajiao.age);
dajiao.age = 25;
console.log(dajiao.age);

//静态属性,不需要实例化,直接用类名点出来
class Girl12 {
  static sayLove() {
    return "I Love You";
  }
}
console.log(Girl12.sayLove());

//只读属性,只可以初始化赋值
class Person12 {
  public readonly _name: string;
  constructor(name: string) {
    this._name = name;
  }
}
const person12 = new Person12("wk");
console.log(person12._name);
